home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / clipper / ks94an.zip / ASUM.HDR < prev    next >
Text File  |  1994-04-25  |  2KB  |  58 lines

  1. /******************************************************************************
  2.                  The Klipper Library, for CA-Clipper 5.x
  3.         Copyright (c), 1994, Wallace Information Systems Engineering
  4.  
  5. FUNCTION:
  6.  
  7. _ASum( anArray, nDim ) --> nSum
  8.  
  9. PARAMETERS:
  10.  
  11. anArray : Array of Numerics
  12. nDim    : The array element dimension (if multi-dimensional)
  13.  
  14. SHORT:
  15.  
  16. Sum the values of an array of numerics.
  17.  
  18. DESCRIPTION:
  19.  
  20. _ASum() returns the sum of all numbers in an array of numerics.
  21.  
  22. If any element of the array is not numeric, it is ignored. Thus, an array of
  23. one character string and five numbers can be summed.  NIL elements are also
  24. ignored.
  25.  
  26. If there are no numeric elements in the array, the return value is ZERO.
  27.  
  28. If the array is multidimensional, you MUST specify nDIM, specifying which
  29. dimension to sum.  If you attempt to _ASum() a multi-dimensional array but do
  30. not specify the dimension, 1 is assumed.
  31.  
  32. NOTE:
  33.  
  34.  
  35.  
  36. EXAMPLE:
  37.  
  38. LOCAL aMonthlyData := { 'Wallace',1,2,3,4,5,6,7,8,9,10,11,12 }
  39.  
  40. t = _ASum( ar )
  41.  
  42. Result: t = 78  Character aMonthlyData[1] is ignored.
  43.  
  44.  
  45. anData1 = { 1,2,3,4,"FIVE",6}
  46.  
  47. anData2 = {  {'One',   1   }, ;
  48.              {'two',   2   }, ;
  49.              {'three', 3   }, ;
  50.              {'four',  4   }, ;
  51.              {'five',  NIL }, ;
  52.              {'six',   6   }  }
  53.  
  54. t = _ASum(anData1)    // 16 single dimension
  55. t = _ASum(anData2,2)  // 16 multi-dimension, checking second dim.
  56.  
  57. ******************************************************************************/
  58.